<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        list-style: none;
        text-decoration: none;
      }
      body {
        width: 100vw;
        min-width: 1200px;
      }
      header {
        margin: 0 auto;
        width: 80%;
        height: 50px;
        background-color: skyblue;
        color: #fff;
        font-size: 30px;
        font-weight: bold;
        text-align: center;
      }
      main {
        margin: 0 auto;
        margin-top: 30px;
        width: 80%;
      }
      ul {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
      }
      li {
        width: 24%;
        height: 470px;
        border: 2px solid #999;
        margin-bottom: 10px;
        display: flex;
        flex-direction: column;
      }
      .imgBox {
        height: 68%;
      }
      img {
        width: 100%;
        display: block;
      }
      .infoBox {
        height: 29%;
        padding: 0 10px ;
        background-color: #fff;
      }
      h2,
      p {
        font-weight: 500;
        font-size: 10px;
        margin-top: 10px;
      }
    </style>
  </head>
  <body>
    <header>网页头部</header>
    <main>
      <ul></ul>
    </main>
  </body>
  <script src="./data.js"></script>
  <script>
    let ul = document.querySelector("ul");
    let ImgPic = document.querySelectorAll(".ImgPic");
    // console.log(ImgPic.src);
    // console.log(list[0].pic);
    // ImgPic[0].src =list[0].pic
    let str = "";
    list.forEach(function (item, index) {
      str += "<li>";
      str += "<div class='imgBox'>";
      str += `<img src='${item.pic}' class='ImgPic'>`;
      str += "</div>";
      str += "<div class='infoBox'>";
      str += `<h2> ${item.name} </h2>`;
      str += `<p>城市：${item.city} </p>`;
      str += `<p>地址：${item.address} </p>`;
      str += `<p>价格：${item.price} </p>`;
      str += `<p>演出时间：${item.showTime} </p>`;
      str += "</div>";
      str += "</li>";
    });
    ul.innerHTML += str;
  </script>
</html>
